package com.jinbo.footmessage.httpretrofit;


import com.jinbo.footmessage.httpbean.BaseBean;
import com.jinbo.footmessage.httpbean.CommentBean;
import com.jinbo.footmessage.httpbean.OrderBean;
import com.jinbo.footmessage.httpbean.OrdersBean;
import com.jinbo.footmessage.httpbean.UserInformationBean;
import com.jinbo.footmessage.httpbean.SendCodeBean;
import com.jinbo.footmessage.httpbean.WorkerInformationBean;
import com.jinbo.footmessage.httpbean.WorkersBean;

import retrofit.Callback;
import retrofit.mime.TypedFile;

public class HttpBusinessStore {


    /**
     * 申请发送手机验证码
     *
     * @param mobile
     * @param callback
     */
    public void sendCode(String mobile, Callback<BaseBean<SendCodeBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).sendCode(mobile, callback);
    }

    /**
     * 注册
     *
     * @param mobile
     * @param password
     * @param name
     * @param callback
     */
    public void register(String mobile, String password, String name, String sex, Callback<BaseBean<UserInformationBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).register(mobile, password, name, sex, callback);
    }


    /**
     * 登录
     *
     * @param mobile
     * @param passWord
     * @param callback
     */
    public void login(String mobile, String passWord, Callback<BaseBean<UserInformationBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).login(mobile, passWord, callback);
    }

    /**
     * 找回密码
     *
     * @param mobile
     * @param password
     * @param callback
     */
    public void findPassword(String mobile, String password, Callback<BaseBean<UserInformationBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).findPassword(mobile, password, callback);
    }

    /**
     * 修改头像
     *
     * @param user_id
     * @param file
     * @param kind
     * @param callback
     */
    public void modifyFace(String user_id, TypedFile file, int kind, Callback<BaseBean<UserInformationBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).modifyFace(user_id, file, kind, callback);
    }

    /**
     * 修改用户名
     *
     * @param user_id
     * @param new_name
     * @param callback
     */
    public void modifyUserName(String user_id, String new_name, Callback<BaseBean<UserInformationBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).modifyUserName(user_id, new_name, callback);
    }

    /**
     * 修改用户性别
     *
     * @param user_id
     * @param sex
     * @param callback
     */
    public void modifyUserSex(String user_id, String sex, Callback<BaseBean<UserInformationBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).modifyUserSex(user_id, sex, callback);
    }

    /**
     * 修改用户邮箱
     *
     * @param user_id
     * @param mail
     * @param callback
     */
    public void modifyUserEmail(String user_id, String mail, Callback<BaseBean<UserInformationBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).modifyUserEmail(user_id, mail, callback);
    }

    /**
     * 修改密码
     *
     * @param user_id
     * @param old_password
     * @param new_password
     * @param callback
     */
    public void modifyUserPassword(String user_id, String old_password, String new_password, Callback<BaseBean<UserInformationBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).modifyUserPassword(user_id, old_password, new_password, callback);
    }

    /**
     * 查看所有技师
     *
     * @param callback
     */
    public void LookWorkers(Callback<BaseBean<WorkersBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).LookWorkers(callback);
    }

    /**
     * 获取我的项目
     *
     * @param user_id
     */
    public void getMyProjects(String user_id, Callback<BaseBean<WorkerInformationBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).getMyProjects(user_id, callback);
    }

    /**
     * 获取技师的评论
     *
     * @param worker_id
     */
    public void getComments(String worker_id, int start, int limit, Callback<BaseBean<WorkerInformationBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).getComments(worker_id, start, limit, callback);
    }

    /**
     * 预约订单
     */
    public void MakeOrder(String date,
                          String week,
                          String begin_time,
                          String end_time,
                          String content,
                          String total_price,
                          String worker_id,
                          String user_id,
                          String contact_name,
                          String contact_address,
                          String contact_phone,
                          String contact_sex,
                          String order_time,
                          Callback<BaseBean<OrderBean>> callback) {
        HttpProtocolFactory.
                getProtocol(HttpProtocolFactory.HOST_URL_USER,
                        HttpProtocol.class).MakeOrder(
                date,
                week,
                begin_time,
                end_time,
                content,
                total_price,
                worker_id,
                user_id,
                contact_name,
                contact_address,
                contact_phone,
                contact_sex,
                order_time, callback);
    }
    /**
     * 查询待确认订单
     *@param user_id
     *
     */
    public void NotConfirmOrder(String user_id,  Callback<BaseBean<OrdersBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).NotConfirmOrder(user_id, callback);
    }

    /**
     * 用户取消待确认的单
     *@param id
     *
     */
    public void CancelOrder(int id,  Callback<BaseBean<OrdersBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).CancelOrder(id, callback);
    }


    /**
     * 查询确认订单
     *@param user_id
     *
     */
    public void  confirmOrder(String user_id, int start, int limit, Callback<BaseBean<OrdersBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).confirmOrder(user_id, start, limit, callback);
    }
    /**
     * 评论订单
     *
     *
     */
    public void  commentOrder(int id, String comment, double star, String time, Callback<BaseBean<CommentBean>> callback) {
        HttpProtocolFactory.getProtocol(HttpProtocolFactory.HOST_URL_USER,
                HttpProtocol.class).commentOrder(id, comment, star, time, callback);
    }
}
